<template>
  <div>
    <component :is="currentComponent" @edit="edit" @receiving="receiving" @returnGoods="returnGoods"  @inbound="inbound" :editInfo="editInfo"   @handleCancel="handleCancel" ref="childComponent" />
  </div>
</template>

<script>
import List from "./list"
import EditPmsPurchaseOrders from "./editPmsPurchaseOrders"
import ReceivingPmsPurchaseOrders from "./receivingPmsPurchaseOrders"
import ReturnGoodsPmsPurchaseOrders from "./returnGoodsPmsPurchaseOrders"
import InboundPmsPurchaseOrders from "./inboundPmsPurchaseOrders"

export default {
  name: "Index",
  components: {List,EditPmsPurchaseOrders,ReceivingPmsPurchaseOrders,ReturnGoodsPmsPurchaseOrders,InboundPmsPurchaseOrders},
  data() {
    return {
      currentComponent:"List",
      addInfo:{},
      editInfo:{}
    }
  },
  created() {
  },
  methods: {
    edit(data){
      this.editInfo = data;
      this.currentComponent= "EditPmsPurchaseOrders";
    },
    receiving(data){
      this.editInfo = data;
      this.currentComponent= "ReceivingPmsPurchaseOrders";
    },
    returnGoods(data){
      this.editInfo = data;
      this.currentComponent= "ReturnGoodsPmsPurchaseOrders";
    },
    inbound(data){
      this.editInfo = data;
      this.currentComponent= "InboundPmsPurchaseOrders";
    },
    handleCancel(){
      this.currentComponent = "List"
    }
  }
}
</script>
<style>

</style>
